import {
  Column,
  DeleteDateColumn,
  Entity,
  PrimaryGeneratedColumn,
} from 'typeorm';
import { Exclude } from 'class-transformer';

@Entity({
  name: 'sms',
  comment: '短信验证码记录表',
})
export class Sms {
  // id
  @PrimaryGeneratedColumn()
  id: number;

  // 创建时间
  @Column({
    name: 'created_at',
    type: 'bigint',
  })
  createdAt: number;

  // 更新时间
  @Column({
    name: 'updated_at',
    type: 'bigint',
  })
  updatedAt: number;

  // 软删除时间
  @DeleteDateColumn({
    name: 'deleted_at',
  })
  @Exclude()
  deletedAt: Date;

  @Column({
    comment: '手机号',
  })
  phone: string;

  @Column({
    comment: '验证码',
  })
  code: string;
}
